package dhadi.model;

import java.util.Date;

/**
 * Piece of Information for exchange. 
 * 
 */
public class Message {
	
	private Date timestamp;
	private Object message;
	public Message(Object message) {
		this.timestamp = new Date(System.currentTimeMillis());
		this.message = message;
	}
	
	public boolean equals(Object message) {
		if (!(message instanceof Message)) return false;
		
		Message otherMessage = (Message)message;
		
		return otherMessage.message.equals(this.message) &&
		       otherMessage.timestamp.equals(this.timestamp);
	}

	public String asString() {
		return message==null?"":message.toString();
	}
}
